<?php
session_start();

error_reporting(E_ALL & ~E_DEPRECATED);
require_once("DB.php");
require_once("db_connect.php");



	$response_data = htmlspecialchars($_POST["response_data"],ENT_QUOTES);
	$thread_id = htmlspecialchars($_POST["thread_id"],ENT_QUOTES);

    $sql = "INSERT INTO response(user_id,thread_id,response_data) VALUES(?,?,?)";
    $stmt = $db->prepare($sql);

    $ary = array($_SESSION[user_id],$thread_id,$response_data);
	$db->execute($stmt,$ary);
    if (DB::isError($db)) {
        exit($res->getMessage());
    }

    header("Location: response.php?thread_id=".$_POST["thread_id"]);